package com.xbongbong.pro.enums.permission.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import lombok.Getter;

import java.util.Objects;

/**
 * @author guohui.zhang
 * @Title: 打印权限枚举
 * @date 2020/10/1918:56
 */
@Getter
public enum PrintProPermissionAliasEnum {
    /**
     * tb_pro_promission对应的alias字段
     */
    // 销售机会打印
    OPPORTUNITY_PRINT(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), "opportunityPrint", ProPermissionAliasEnum.OPPORTUNITY_PRINT.getI18nMemo()),
    // 合同订单打印
    CONTRACT_PRINT(XbbRefTypeEnum.CONTRACT.getCode(), "contractPrint", ProPermissionAliasEnum.CONTRACT_PRINT.getI18nMemo()),
    // 工作报告打印
    WORK_REPORT_PRINT(XbbRefTypeEnum.WORK_REPORT.getCode(), "workReportPrint", ProPermissionAliasEnum.WORK_REPORT_PRINT.getI18nMemo()),
    // 采购合同打印
    PURCHASE_PRINT(XbbRefTypeEnum.PURCHASE.getCode(), "purchasePrint", ProPermissionAliasEnum.PURCHASE_PRINT.getI18nMemo()),
    // 采购退货dayin
    RETURN_PURCHASE_PRINT(XbbRefTypeEnum.RETURNED_PURCHASE.getCode(), "returnPurchasePrint", ProPermissionAliasEnum.RETURN_PURCHASE_PRINT.getI18nMemo()),
    // 装配出入库单
    ASSEMBLE_PRINT(XbbRefTypeEnum.ASSEMBLE.getCode(), "assemblePrint", ProPermissionAliasEnum.ASSEMBLE_PRINT.getI18nMemo()),
    // 入库单
    INSTOCK_PRINT(XbbRefTypeEnum.OTHER_INSTOCK.getCode(), "instockPrint", ProPermissionAliasEnum.INSTOCK_PRINT.getI18nMemo()),
    // 出库单
    OUTSTOCK_PRINT(XbbRefTypeEnum.OTHER_OUTSTOCK.getCode(), "outstockPrint", ProPermissionAliasEnum.OUTSTOCK_PRINT.getI18nMemo()),
    // 盘点单,
    INVENTORY_PRINT(XbbRefTypeEnum.INVENTORY.getCode(), "inventoryPrint", ProPermissionAliasEnum.INVENTORY_PRINT.getI18nMemo()),
    // 调拨单
    TRANSFER_PRINT(XbbRefTypeEnum.TRANSFER.getCode(), "transferPrint", ProPermissionAliasEnum.TRANSFER_PRINT.getI18nMemo()),
    // BOM清单
    BOM_PRINT(XbbRefTypeEnum.BOM_BILL.getCode(), "bomBillPrint", ProPermissionAliasEnum.BOM_BILL_PRINT.getI18nMemo()),
    // 生产单打印,
    PRODUCTION_ORDER_PRINT(XbbRefTypeEnum.PRODUCTION_ORDER.getCode(), "productionOrderPrint", ProPermissionAliasEnum.PRODUCTION_ORDER_PRINT.getI18nMemo()),
    // 报价单
    QUOTATION_PRINT(XbbRefTypeEnum.QUOTATION.getCode(), "quotationPrint", ProPermissionAliasEnum.QUOTATION_PRINT.getI18nMemo()),
    // 退货退款打印
    REFUND_PRINT(XbbRefTypeEnum.REFUND.getCode(), "refundPrint", ProPermissionAliasEnum.REFUND_PRINT.getI18nMemo()),
    // 采购入库单
    PURCHASE_INSTOCK_PRINT(XbbRefTypeEnum.PURCHASE_INSTOCK.getCode(), "purchaseInstockPrint", ProPermissionAliasEnum.PURCHASE_INSTOCK_PRINT.getI18nMemo()),
    // 销售退货入库单
    REFUND_INSTOCK_PRINT(XbbRefTypeEnum.REFUND_INSTOCK.getCode(), "refundInstockPrint", ProPermissionAliasEnum.REFUND_INSTOCK_PRINT.getI18nMemo()),
    // 生成入库单
    PRODUCTION_INSTOCK_PRINT(XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode(), "productionInstockPrint", ProPermissionAliasEnum.PRODUCTION_INSTOCK_PRINT.getI18nMemo()),
    // 生产退料单,
    RETURNED_MATERIEL_INSTOCK_PRINT(XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode(), "returnedMaterielInstockPrint", ProPermissionAliasEnum.RETURNED_MATERIEL_INSTOCK_PRINT.getI18nMemo()),
    // 销售出库单
    CONTRACT_OUTSTOCK_PRINT(XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(), "contractOutstockPrint", ProPermissionAliasEnum.CONTRACT_OUTSTOCK_PRINT.getI18nMemo()),
    // 采购退货出库单
    RETURNED_PURCHASE_OUTSTOCK_PRINT(XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode(), "returnedPurchaseOutstockPrint", ProPermissionAliasEnum.RETURNED_PURCHASE_OUTSTOCK_PRINT.getI18nMemo()),
    // 生产领料单
    MATERIEL_OUTSTOCK_PRINT(XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode(), "materielOutstockPrint", ProPermissionAliasEnum.PRODUCTION_MATERIEL_OUTSTOCK_PRINT.getI18nMemo()),
    // 工单出库打印
    WORKORDER_OUTSTOCK_PRINT(XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getCode(), "workOrderOutstockPrint", ProPermissionAliasEnum.WORK_ORDER_OUTSTOCK.getI18nMemo()),
    // 回款单
    PAYMENT_PRINT(XbbRefTypeEnum.PAYMENT.getCode(), "paymentPrint", ProPermissionAliasEnum.PAYMENT_PRINT.getI18nMemo()),
    // 回款单打印
    PAYMENT_SHEET_PRINT(XbbRefTypeEnum.PAYMENT_SHEET.getCode(), "paymentSheetPrint", ProPermissionAliasEnum.PAYMENT_SHEET_PRINT.getI18nMemo()),
    // 销项发票打印
    INVOICE_PRINT(XbbRefTypeEnum.INVOICE.getCode(), "invoicePrint", ProPermissionAliasEnum.INVOICE_PRINT.getI18nMemo()),
    // 付款打印
    PAYPLAN_PRINT(XbbRefTypeEnum.PAY_PLAN.getCode(), "payPlanPrint", ProPermissionAliasEnum.PAY_PLAN_PRINT.getI18nMemo()),
    // 付款单打印,
    PAYSHEET_PRINT(XbbRefTypeEnum.PAY_SHEET.getCode(), "paySheetPrint", ProPermissionAliasEnum.PAY_SHEET_PRINT.getI18nMemo()),
    // 进项发票打印
    PURCHASE_INVOICE_PRINT(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), "purchaseInvoicePrint", ProPermissionAliasEnum.PURCHASE_INVOICE_PRINT.getI18nMemo()),
    // 工单打印
    WORK_RDER_PRINT(XbbRefTypeEnum.WORK_ORDER.getCode(), "workOrderPrint", ProPermissionAliasEnum.WORK_ORDER_PRINT.getI18nMemo()),

    // 其他收入单打印
    OTHER_INCOME_PRINT(XbbRefTypeEnum.OTHER_INCOME.getCode(), "otherIncomePrint", ProPermissionAliasEnum.OTHER_INCOME_PRINT.getI18nMemo()),
    // 其他支出单打印
    OTHER_EXPENSE_PRINT(XbbRefTypeEnum.OTHER_EXPENSE.getCode(), "otherExpensePrint", ProPermissionAliasEnum.OTHER_EXPENSE_PRINT.getI18nMemo()),
    // 回执单打印
    RECEIPT_ORDER_PRINT(XbbRefTypeEnum.RECEIPT_ORDER.getCode(), "receiptOrderPrint", ProPermissionAliasEnum.RECEIPT_ORDER_PRINT.getI18nMemo()),
    // 竞争对手打印
    COMPETITOR_PRINT(XbbRefTypeEnum.COMPETITOR.getCode(), "competitorPrint", ProPermissionAliasEnum.COMPETITOR_PRINT.getI18nMemo()),
    /**
     * 工单v2
     */
    WORK_ORDER_V2(XbbRefTypeEnum.WORK_ORDER_V2.getCode(), ProPermissionAliasEnum.WORK_ORDER_V2_PRINT.getAlias(), ProPermissionAliasEnum.WORK_ORDER_V2_PRINT.getI18nMemo()),
    RECEIPT_ORDER(XbbRefTypeEnum.RECEIPT_ORDER.getCode(), ProPermissionAliasEnum.RECEIPT_ORDER_PRINT.getAlias(), ProPermissionAliasEnum.RECEIPT_ORDER_PRINT.getI18nMemo()),


    ;

    private Integer code;

    private String alias;

    private String memo;

    PrintProPermissionAliasEnum(Integer code, String alias, String memo) {
        this.code = code;
        this.alias = alias;
        this.memo = memo;
    }

    public static PrintProPermissionAliasEnum getByCode(Integer businessType) {
        for (PrintProPermissionAliasEnum item: values()) {
            if (Objects.equals(item.getCode(), businessType)) {
                return item;
            }
        }
        return null;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }
}
